package com.douyu.ocean.recom.platfrom.core.config;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.douyu.ocean.recom.platfrom.core.constants.ConfigConstant;
import com.douyu.ocean.recom.platfrom.core.utils.DataSourceUtils;
import com.douyu.ocean.recom.platfrom.core.utils.PropertiesUtils;

@Configuration
@EnableTransactionManagement
// @PropertySource("classpath:jdbc-mysql.properties")
// 使用xml配置mybatis，省去转换配置项类型的麻烦，写sql方便维护
@ImportResource("classpath:spring/spring-dataSource.xml")
public class DataSourceConfig {

	@Bean(name = "sttDataSource")
	@Qualifier("sttDataSource")
	public DataSource sttDataSource() throws Throwable {

		return DataSourceUtils.getDateSource(PropertiesUtils.get(ConfigConstant.JDBC_STT_BIGDATA_URL.val()),
				PropertiesUtils.get(ConfigConstant.MYSQL_DRIVER.val()));
	}
	
	
}
